package com.kehutong.crm.entity;

import java.util.ArrayList;
import java.util.List;
import org.coraframework.bean.valid.CheckField;
import org.coraframework.orm.Entity;
import org.coraframework.orm.annotation.Column;
import org.coraframework.orm.annotation.Table;
import org.coraframework.orm.annotation.UnSave;

@Table(value="t_words_share_platform", comment="公共常用语")
public class WordsSharePlatform extends Entity {

	private static final long serialVersionUID = -4700612955969914357L;

	protected WordsSharePlatform(String id) {
		super(id);
	}

	@Column(comment="上级文件夹编号")
	private String pid;

	@CheckField("常用语不能为空")
	@Column(length=512, comment="常用语")
	private String name;

	@Column(comment="是否文件夹")
	private boolean isFolder;

	@Column(comment="逻辑删除")
	private boolean deleted;

	@UnSave
	private List<WordsSharePlatform> childList;

	public String getPid() {
		return pid;
	}

	public void setPid(String pid) {
		this.pid = pid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public boolean isFolder() {
		return isFolder;
	}

	public void setFolder(boolean isFolder) {
		this.isFolder = isFolder;
	}

	public void setIsFolder(boolean isFolder) {
		this.isFolder = isFolder;
	}

	public boolean isDeleted() {
		return deleted;
	}

	public void setDeleted(boolean deleted) {
		this.deleted = deleted;
	}

	public List<WordsSharePlatform> getChildList() {
		return childList;
	}

	public void setChildList(List<WordsSharePlatform> childList) {
		this.childList = childList;
	}

	public void addChild(WordsSharePlatform wordsShare) {
		if (childList == null) {
			childList = new ArrayList<>();
		}
		childList.add(wordsShare);
	}

}
